<template>
  <div class="dashbored">
    <div class="top">
      <el-card class="box-card">
        <div class="main">
          <div class="m-left">
            <img src="@/assets/common/img.jpeg">
          </div>
          <div class="m-right">
            <div class="mr-top">
              下午好,我们是优秀的前端85期
            </div>
            <div class="mr-bottom">
              双12快乐,给我买些礼物吧
            </div>
          </div>
        </div>
      </el-card>
    </div>
    <div class="bottom">
      <el-row>
        <el-col :span="14">
          <div style="padding-right:30px">
            <el-card class="box-card">
              <el-calendar>
                <!-- 这里使用的是 2.5 slot 语法，对于新项目请使用 2.6 slot 语法-->
                <template
                  slot="dateCell"
                  slot-scope="{date, data}"
                >
                  <!-- <p :class="data.isSelected ? 'is-selected' : ''">
                    {{ data.day.split('-').slice(1).join('-') }} {{ data.isSelected ? '✔️' : '' }}
                  </p> -->
                  <!-- <span>{{ getCurrentDate(data.day) }}</span>
                  <span>休</span> -->
                  <div class="my-date">
                    <span>{{ getCurrentDate(data.day) }}</span>
                    <span v-if="isWeekend(date)" class="item-2">休</span>
                  </div>
                </template>
              </el-calendar>
            </el-card>
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <span>卡片名称</span>
                <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
              </div>
              <div v-for="o in 4" :key="o" class="text item">
                {{ '列表内容 ' + o }}
              </div>
            </el-card>
          </div>
        </el-col>
        <el-col :span="10">
          <div style="padding-right:30px">
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <span>卡片名称</span>
                <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
              </div>
              <div v-for="o in 4" :key="o" class="text item">
                {{ '列表内容 ' + o }}
              </div>
            </el-card>
            <Redix />
            <el-card class="box-card">
              <div class="last">
                <div class="l-header">
                  <span>帮助链接</span>
                </div>
                <div class="l-main">内容</div>
              </div></el-card>
            <el-card class="box-card">
              <div slot="header" class="clearfix">
                <span>卡片名称</span>
                <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
              </div>
              <div v-for="o in 4" :key="o" class="text item">
                {{ '列表内容 ' + o }}
              </div>
            </el-card>
          </div>
        </el-col>
      </el-row>

    </div>
  </div>
</template>

<script>
import Redix from './radix.vue'
export default {
  name: 'VueHr85Index',
  components: {
    Redix
  },
  data() {
    return {
    }
  },
  methods: {
    fn(date, data) {
      console.log(date, data)
    },
    getCurrentDate(date) {
      console.log(date)
      const currentDateStr = date.slice(8)
      return currentDateStr.startsWith('0') ? currentDateStr.slice(1) : currentDateStr
    },
    // 函数 判断当前日期对象,是否是周末,getDay()是否等于0或者6
    isWeekend(date) {
      // date是一个日期对象,它就是由new Date 构造函数new出来的对象
      const currentDay = date.getDay()
      if (currentDay === 0 || currentDay === 6) {
        return true
      }
      return false
    }
  }
}
</script>

<style lang="scss" scoped>
.dashbored{
  margin:15px;
  .top{
    margin-bottom: 15px;
  }
  .el-card {
    margin-bottom: 15px;
  }
   .my-date {
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    align-items: center;
    height: 100%;
    .item-2 {
      display: block;
      width: 25px;
      height: 25px;
      background-color: #f5aa42;
      text-align: center;
      line-height: 25px;
      color: white;
      border-radius: 50%;
    }
  }
  .main {
    display: flex;
    .m-left {
      // 行内块元素 inline-block， 有时候多个图片排列的时候，图片的底部对不齐，有一些间隙
      // 一般工作流里面需要将图片转换为块级元素
      img {
        display: block;
        // 图片一般只需要设置宽或者高， 一个值就可以了，两个都设置话，图片就失真了
        width: 100px;
        // height: 10px;
      }
    }
    .m-right {
      display: flex;
      flex-direction: column;
      justify-content: space-around;
      .mr-top {
         font-size: 22px;
        font-weight: 600;
      }
      .mr-bottom {
        color: #beb8b8;
        position: relative;
        top: -15px;
        left: 5px;
      }
    }
    .is-selected {
    color: #1989FA;
  }
  }
  .last {

    .l-header {
      font-size: 25px;
        font-weight: 600;
      span {
        border-bottom: 5px solid #767aea;
        padding-bottom: 10px;
        }
      }
    .l-main {
      margin-top: 25px;
    }
  }
}

</style>
